package com.kt.springcloud.service;

import com.kt.springcloud.entity.ApiResult;
import com.kt.springcloud.entity.Payment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @author DengXin
 * @date 2022/10/5 19:19
 */
@Component
@FeignClient(value = "CLOUD-PAYMENT-SERVICE")
public interface OrderFeign {

    /**
     * 调用服务提供方——根据id获取具体实体
     *
     * @param id
     * @return
     */
    @GetMapping(value = "/payment/get/{id}")
    ApiResult<Payment> getPaymentById(@PathVariable("id") Long id);

    /**
     * 模拟Feign调用超时场景
     *
     * @return
     */
    @GetMapping(value = "/payment/feign/timeout")
    String paymentFeignTimeout();
}
